﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace WcfServiceBomberman.Contracts.Duplex
{
    interface IServiceGameServerCallback
    {
        [OperationContract(IsOneWay = true)]
        void newGame(Match game);
    }

    [DataContract]
    public enum Type : ushort {
        [EnumMember]
        SOLO,
        [EnumMember]
        DUO,
        [EnumMember]
        FFA
    };

    [DataContract]
    public class Match
    {
        [DataMemberAttribute]
        public UInt16 game_id;
        [DataMemberAttribute]
        public Type type;
        [DataMemberAttribute]
        public List<Team> teams;

        public Match(UInt16 game_id, Type type, List<Team> teams)
        {
            this.type = type;
            this.teams = teams;
        }
    }

    [DataContract]
    public class Team
    {
        [DataMemberAttribute]
        public List<Player> players;
        [DataMemberAttribute]
        public UInt16 id;

        public Team()
        {
            players = new List<Player>();
        }
    }

    [DataContract]
    public class Player
    {
        [DataMemberAttribute]
        private UInt32 uid;
        [DataMemberAttribute]
        private string nickname;
        [DataMemberAttribute]
        private UInt16 speed;
        [DataMemberAttribute]
        private UInt16 delay;
        [DataMemberAttribute]
        private UInt16 bomb;
        [DataMemberAttribute]
        private UInt16 range;

        public Player(UInt16 uid, string nickname, UInt16 speed, UInt16 delay, UInt16 bomb, UInt16 range)
        {
            this.uid = uid;
            this.nickname = nickname;
            this.speed = speed;
            this.delay = delay;
            this.bomb = bomb;
            this.range = range;
        }
    }


}
